#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "UMLDiagramElement.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class Point;
class UMLDiagramElement;

/// <summary>
/// UMLEdge
/// The most general class for UML diagram elements that are rendered as lines.
/// </summary>
class UMLMODEL_EXPORT UMLEdge : public UMLDiagramElement {

public: // Constructors and destructors
    explicit UMLEdge(const QString& umlType="uml::UMLEdge");

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Properties
    /// <summary>
    /// source getter
    /// Restricts the sources of UMLEdges to UMLDiagramElements.
    /// </summary>
    shared_ptr<UMLDiagramElement> source() const;

    /// <summary>
    /// source setter
    /// Restricts the sources of UMLEdges to UMLDiagramElements.
    /// </summary>
    void setSource(shared_ptr<UMLDiagramElement> value);

    /// <summary>
    /// target getter
    /// Restricts the targets of UMLEdges to UMLDiagramElements.
    /// </summary>
    shared_ptr<UMLDiagramElement> target() const;

    /// <summary>
    /// target setter
    /// Restricts the targets of UMLEdges to UMLDiagramElements.
    /// </summary>
    void setTarget(shared_ptr<UMLDiagramElement> value);

    /// <summary>
    /// waypoints getter
    /// an optional list of points relative to the origin of the nesting diagram that
    /// specifies the connected line segments of the edge
    /// </summary>
    vector<shared_ptr<Point>>& waypoints();

private: // Fields
    /// <summary>
    /// source
    /// Restricts the sources of UMLEdges to UMLDiagramElements.
    /// </summary>
    shared_ptr<UMLDiagramElement> source_;

    /// <summary>
    /// target
    /// Restricts the targets of UMLEdges to UMLDiagramElements.
    /// </summary>
    shared_ptr<UMLDiagramElement> target_;

    /// <summary>
    /// waypoints
    /// an optional list of points relative to the origin of the nesting diagram that
    /// specifies the connected line segments of the edge
    /// </summary>
    vector<shared_ptr<Point>> waypoints_;

};

} // namespace uml
